from tasks.main import celery_app
from ronglian_sms_sdk import SmsSDK


accid = '8aaf07087f77bf96017fde92f64e355c'
authtoken = '837b4695750245e2b41246eb8aeaf0ee'
appid = '8aaf07087f77bf96017fde92f74e3563'

#执行任务
@celery_app.task
def sms_code(code, mobile,expire=5):
    sdk = SmsSDK(accid,authtoken,appid)
    # 准备数据
    tid = "1"
    datas = ("%s"%code,"%s"%expire)

    #发送请求
    res = sdk.sendMessage(tid=tid,mobile=mobile,datas=datas)
    return res
